<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>咨客_交换房间</title>
		<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet" type="text/css">
		<link href="<c:url value="/resources/css/default/easyui.css" />" rel="stylesheet" type="text/css">
		<link href="<c:url value="/resources/css/icon.css" />" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="<c:url value="/resources/js/util.js" />"></script>
		<script type="text/javascript">
			function onReset(){
				$("#srcRoom").val('');
				$("#newRoom").val('');
			}
			
			function onReturn(){
				location.href = "${pageContext.request.contextPath}/consultToken/tokenList";
			}
			
			function onExchange(){
				if($.trim($("#srcRoom").val()) == ''){
					$.messager.alert('警告','原房间编号不能为空!');
					return false;
				}
				
				if($.trim($("#newRoom").val()) == ''){
					$.messager.alert('警告','新房间编号不能为空!');
					return false;
				}
				
				$.ajax({
					url:'exchangeRoom',
					data:{'srcRoom':$.trim($("#srcRoom").val()), 
						  'newRoom':$.trim($("#newRoom").val())},
					type:'post',
					dataType:'text',
					async:false,
					cache:false,
					success:function(data){
						if(data == 'success'){
							onReset();
							$.messager.alert('操作结果', "交换房间成功!");
						}else
							$.messager.alert('操作结果', data);
					}
				});
			}
		</script>
	</head>
	
	<body>
		<c:import url="/WEB-INF/resources/common/consult_header.jsp" />
		
		<h1>交换房间</h1>
		
		<div style="float:left; width:800px;margin-right: 30px;">
			<div>				
				<div style="max-height:30px;margin-left: 100px;">
					原房间编号：
					<input class="easyui-validatebox" style="width:150px;" type="text"  name="srcRoom" id="srcRoom" data-options="required:true" />
				</div>
				<br/>
				<div style="max-height:30px;margin-left: 100px;">
					新房间编号：
					<input class="easyui-validatebox" style="width:150px;" type="text"  name="newRoom" id="newRoom" data-options="required:true" />
				</div>
				
				<div style="margin-top:15px; max-height:30px;margin-left: 150px;">					
					<input type="button" name="queryBtn" value="换房间" onclick="onExchange()" />&nbsp;&nbsp;
					<input type="button" name="queryBtn" value="重置" onclick="onReset()">&nbsp;&nbsp;
					<input type="button" name="queryBtn" value="返回F3" onclick="onReturn()">
				</div>
			</div>
		</div>
	</body>
</html>